import numpy as np
import matplotlib.pyplot as plt

mu = 0
sigma = 8


# 高斯分布公式
def get_gaussian_result(x):
    a = 1 / ((2 * np.pi) ** 0.5 * sigma)
    b = np.exp(-(x - mu) ** 2 / (2 * sigma ** 2))
    return a * b


x1 = np.linspace(-10, 10, 40)
x2 = np.linspace(-10, 10, 40)
# 绘制平面，需要两个坐标轴内容交织
x1, x2 = np.meshgrid(x1, x2, indexing='ij')

y = get_gaussian_result(x1) + get_gaussian_result(x2)

ax = plt.subplot(111, projection='3d')
ax.plot_surface(x1, x2, y, cmap=plt.cm.YlGnBu_r)
plt.show()
